package com.mdb.open.trade.service.product;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mdb.bc.database.mybatisplus.SuperService;
import com.mdb.open.trade.common.MdbDataSource;
import com.mdb.open.trade.domain.po.product.CustProdConfig;
import com.mdb.open.trade.mapper.product.CustProdConfigMapper;
import org.springframework.stereotype.Service;

/**
 * 类描述：
 *  客户产品App信息表 服务类
 *
 * @author liuyi
 * @date 2019-07-08
 */
@Service
@DS(MdbDataSource.PRODUCT)
public class CustProdConfigService extends SuperService<CustProdConfigMapper, CustProdConfig> {

    /**
     * 根据appId获取数据
     */
    public CustProdConfig getByAppId(String appId) {
        return this.getOne(new LambdaQueryWrapper<CustProdConfig>().eq(CustProdConfig::getAppId, appId));
    }

    public CustProdConfig getByCustProdCode(String customerCode, String prodCode) {
        return this.baseMapper.selectOne(new LambdaQueryWrapper<CustProdConfig>()
                .eq(CustProdConfig::getCustomerCode, customerCode)
                .eq(CustProdConfig::getProdCode, prodCode));
    }
}
